﻿#pragma once

//#include 

#include <string>

//#include <windef.h>
#include <Windows.h>
#include <shellapi.h>
#pragma comment(lib, "Shell32")


class ShellExecuteHelper
{
    /// 返回成功 (ERROR_SUCCESS) 时，errorMessage 成功带回错误消息
    DWORD GetSystemErrorCodeMessage(DWORD errCode, std::string& errorMessage);
public:
    ShellExecuteHelper();
    virtual ~ShellExecuteHelper();


    BOOL GetModuleExecutable(OUT std::string & executable);
    BOOL GetModuleDirectory(OUT std::string& directory);

    BOOL GetSystemErrorCodeFromHinst(HINSTANCE hInstApp, DWORD& errorCode);
    std::string GetErrTextFromHinst(HINSTANCE hInstApp);

    DWORD LaunchFromProgramWithParameter(const char* executable, const char* parameters, const char* workDirectory, const char* verb = NULL, std::string* erroeMessage = NULL);

    BOOL GetProcessElevation(TOKEN_ELEVATION_TYPE* pElevationType, BOOL* pIsAdmin);
};

